// MoldingOHTView.h : interface of the CMoldingOHTView class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_MoldingOHTVIEW_H__800AFEFE_CD9E_40B4_B417_78FD83272239__INCLUDED_)
#define AFX_MoldingOHTVIEW_H__800AFEFE_CD9E_40B4_B417_78FD83272239__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include ".\Util\MinButton.h"
#include ".\Util\MinLabel.h"
#include ".\Util\MinDigital.h"
#include ".\Util\SxGroupBox.h"
#include "Util/msflexgrid.h"

// Hardware Layer
class IIO;
class IPIO;
class IOnLine;
class IConveyor;
// Process Layer
class IAutoManager;
class ITrsUnloadConveyor;
class ITrsLoadConveyor;
// Common Layer
class CSystemData;
class CMoldingOHTDoc;
class CModelData;



class CMoldingOHTView : public CFormView
{
private:
	IIO* m_lnkIO;
	BOOL StartInitFlag;
	BOOL m_bOldStatusPush[12];


	ITrsLoadConveyor* m_lnkTrsLoadConveyor;
	ITrsUnloadConveyor* m_lnkTrsUnloadConveyor;

protected: // create from serialization only
	CMoldingOHTView();
	DECLARE_DYNCREATE(CMoldingOHTView)

public:
	//{{AFX_DATA(CMoldingOHTView)
	enum { IDD = IDD_MoldingOHT_FORM };
	CMinButton	m_btnInterface;
	CMinButton	m_bStart;
	CMinButton	m_bStop;
	CMinButton	m_bExit;
	CMinButton	m_bInit;
	CMinButton	m_bErrorList;
	CMinButton	m_bMainMode;
	CMinButton	m_bDataMode;
	CMinButton	m_bManualMode;
	CMinButton	m_bMode;
	CMinButton	m_bLoadHold;
	CMinButton	m_bUnloadHold;
	CMSFlexGrid	m_gridDataInfo;
	//}}AFX_DATA

// Attributes
public:
	CMoldingOHTDoc* GetDocument();
	void UpdateMagazineStatus();
	void LoadBitMap();
	void PeekAndPump();
	void DisplayMachineTact(CString strTact);
	CBitmap		m_BitMap[MAX_MAGAZINE];
	CStatic		m_LoadMagazineInStatusBitmap;
	CStatic		m_LoadMagazineStopperStatusBitmap;
	CStatic		m_LoadMagazineCountStatusBitmap;
	CStatic		m_LoadMagazineOutStatusBitmap;
	CStatic		m_UnloadMagazineInStatusBitmap;
	CStatic		m_UnloadMagazineStopperStatusBitmap;
	CStatic		m_UnloadMagazineOutStatusBitmap;

	CSxGroupBox m_bGroup[2];


// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CMoldingOHTView)
	public:
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	virtual void OnInitialUpdate(); // called first time after construct
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnPrint(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView);
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CMoldingOHTView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	CSystemData* m_lnkSystemData;
	CMoldingOHTDoc* m_pDoc;
	IAutoManager* m_lnkAutoManager;
	CModelData* m_lnkModelData;
	IM2MInterface* m_lnkM2MInterface;
	IPIO* m_lnkPIO;
	IConveyor* m_lnkIConveyor;
	IOnLine* m_lnkOnLine;

	ITrsLoadConveyor* m_pTrsLoadConveyor;
	ITrsUnloadConveyor* m_pTrsUnloadConveyor;


	void GridInitial();
	void ButtonInitial();
	void ButtonUpdate();
	void GridSystem();

	UINT m_nTimerID;
	BOOL m_TimerInitFlag;
	BOOL m_flgUVTimeStart;
	BOOL m_flgUVOn;
	BOOL m_flgAuto;
	CListBox	m_listSystemLog;
	CTimerCheck m_nTimer;


	//{{AFX_MSG(CMoldingOHTView)
	afx_msg void OnMainmode();
	afx_msg void OnDatamode();
	afx_msg void OnManualmode();
	afx_msg void OnInit();
	afx_msg void OnErrorLog();
	afx_msg void OnStart();
	afx_msg void OnStop();
	afx_msg void OnExit();
	afx_msg void OnPaint();
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnStepStop();
	afx_msg void OnInterfaceCheck();
	afx_msg void OnLoadHold();
	afx_msg void OnUnloadHold();
	//}}AFX_MSG

	afx_msg LRESULT OnDisplaySystemLog(UINT wParam, LPARAM lParam);

	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in MoldingOHTView.cpp
inline CMoldingOHTDoc* CMoldingOHTView::GetDocument()
   { return (CMoldingOHTDoc*)m_pDocument; }
#endif

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_MoldingOHTVIEW_H__800AFEFE_CD9E_40B4_B417_78FD83272239__INCLUDED_)
